package com.sinosoft.tcmneim.controller;

import com.sinosoft.tcmneim.dataObject.TblBasicinformation;
import com.sinosoft.tcmneim.response.ResponseData;
import com.sinosoft.tcmneim.service.TblBasicinformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 基地信息填报-基本信息 Controller
 *
 * @author bjc
 * @date 2021-09-15
 */
@Controller
@RequestMapping("/tblBasicinformation")
public class TblBasicinformationController {

    @Autowired
    TblBasicinformationService tblBasicinformationService;
    /**
     * 查询基本信息
     */
    @GetMapping("/list")
    @ResponseBody
    public ResponseData list(){
        ResponseData responseData = new ResponseData();
        responseData.setData(tblBasicinformationService.list());
        return responseData ;
    }
    /**
     * 根据ID查询基本信息
     */
    @GetMapping("/selectByItemCode/{itemCode}")
    @ResponseBody
    public Object selectByItemCode(@PathVariable("itemCode")String itemCode){
        return tblBasicinformationService.selectByItemCode(itemCode);
    }

    /**
     * 新增基本信息
     */
    @PostMapping("/save")
    public int save(TblBasicinformation tblBasicinformation){
        return tblBasicinformationService.insertTblBasicinformation(tblBasicinformation);
    }
    /**
     * 修改基本信息
     */
    @PostMapping("/updated")
    public int updated(TblBasicinformation tblBasicinformation){
        return tblBasicinformationService.updated(tblBasicinformation);
    }
    /**
     * 删除基本信息
     */
    @PostMapping( "/remove")
    public int remove(String  itemCode)
    {
        return tblBasicinformationService.deleteByItemCode(itemCode);
    }


}
